Page({
  data: {
    activity: null,
    reserving: false
  },

  onLoad(options) {
    // 模拟获取活动详情数据
    this.setData({
      activity: {
        id: options.id,
        title: '周末户外徒步活动',
        imageUrl: 'https://ts1.tc.mm.bing.net/th/id/R-C.148101c205857241d1666d8d55d09eda?rik=emNVnf9uHL79Fg&riu=http%3a%2f%2fclubimg.club.vmall.com%2fdata%2fattachment%2fforum%2f202004%2f21%2f232808a58jxcywkezumtpe.jpg&ehk=lioHPAdzEqJwA%2bFZznIyKDWb6mew5xjFF2JeGHyicvY%3d&risl=&pid=ImgRaw&r=0',
        time: '2024-03-20 14:00',
        location: '城市公园',
        registeredCount: 128,
        price: 99,
        isRegistered: false,
        description: '这是一次充满挑战和乐趣的户外徒步活动。我们将带领大家探索城市周边的自然风光，感受大自然的魅力。活动路线经过精心规划，适合各个年龄段的参与者。\n\n活动亮点：\n1. 专业领队带队\n2. 提供基础装备\n3. 包含保险服务\n4. 提供补给物资\n\n让我们一起走出城市，拥抱自然！',
        notices: [
          '请穿着舒适的运动鞋和适合户外活动的服装',
          '建议携带防晒用品和饮用水',
          '活动前请确保身体状况良好',
          '未成年人需有监护人陪同',
          '如遇恶劣天气，活动将延期举行'
        ]
      }
    });
  },

  handleReserve() {
    if (this.data.activity.isRegistered) {
      wx.showToast({
        title: '您已预约该活动',
        icon: 'none'
      });
      return;
    }

    this.setData({ reserving: true });

    // 模拟预约请求
    setTimeout(() => {
      this.setData({
        reserving: false,
        'activity.isRegistered': true,
        'activity.registeredCount': this.data.activity.registeredCount + 1
      });

      wx.showToast({
        title: '预约成功',
        icon: 'success'
      });
    }, 1500);
  }
}) 